package me.beagle.training.stream;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * Created by LiuLingHan on 2017/4/11.
 */
public class StreamUtils {

    public static <T,R> List<R> getProps(final Collection<T> collections, Function<T,R> func){
        return (collections == null || collections.isEmpty())?
                Collections.emptyList():
                (List<R>) collections.stream().map(func).collect(Collectors.toList());

    }
}
